package vfs.dao;

import java.io.Serializable;

import javax.persistence.Embeddable;

@Embeddable
public class PathKey implements Serializable {


    private long descendant;
    private long ancestor;

    public PathKey() {}

    public PathKey(Long ancestor, Long descendant) {
        this.ancestor = ancestor;
        this.descendant = descendant;
    }

    public long getDescendant() {
        return descendant;
    }

    public long getAncestor() {
        return ancestor;
    }

    public boolean equals(Object obj) {
        if ( !(obj instanceof PathKey)) {
            return false;
        }

        PathKey ppk = (PathKey) obj;

        return (this.ancestor == ppk.getAncestor()) &&
            (this.descendant == ppk.getDescendant());

    }

    public int hashCode() {

        return String.valueOf(this.ancestor).hashCode() ^
            String.valueOf(this.descendant).hashCode();
    }
}
